﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace NotifierService
{
    public abstract class SingletonBase<T> where T : new()
    {
        protected static T _instance;
        protected static volatile bool _instCreated = false;

        public static T Instance
        {
            get
            {
                if (!_instCreated)
                {
                    _instance = new T();
                    _instCreated = true;
                }

                return _instance;
            }
        }

        public static T GetInstance()
        {
            return Instance;
        }
    }
}
